<template>
	<view class="content">
		<navigator url="/pages/detail/detail?id=111" data-name="你好啊" hover-class="navigator-hover">
			<button type="default">跳转到新页面</button>
		</navigator>
		<image class="logo" src="/static/logo.png"></image>
		<view>
			<text class="title">{{title}}</text>
		</view>
		<view v-if="myData.length>0">
			<image :src="myData[0].imgUrl"></image>
		</view>
		<view v-if="myData.length>0">
			{{myData[0].imgUrl}}
		</view>
		<view v-for="(item,index) in list" :key="index">
			<button type="primary" @tap="itemClick(item)" >{{item.a}}</button>
		</view>
		<view>
			<navigator url="/pages/cover-image/cover-image">跳转cover-image</navigator>
		</view>
		<button type="primary" @tap="navSwiper">跳转到swiper页面</button>
		<view>
			<vue-pwd :isDisplay="false"></vue-pwd>
		</view>
	</view>
</template>
<script>
	import {
		getLunBoTu
	} from "../../api/getData";
	import {
		mapMutations,
		mapState,
		mapGetters
	} from "vuex";
	import vuePwd from '../../components/vue-pwd/vue-pwd'
	export default {
		data() {
			return {
				title: 'Hello',
				myData: [],
				list:[{a:12},{a:13},{a:14}]
			}
		},
		computed: {
			...mapGetters(["token"])
		},
		onLoad() {
			this.initData();
		},
		components:{
			vuePwd
		},
		methods: {
			...mapMutations(["SET_TOKEN"]),
			async initData() {
				const res = await getLunBoTu();
				console.log(res.data);
				if (res.success) {
					this.myData = res.data;
				}
				console.log(JSON.stringify(this.myData));
				// this.SET_TOKEN("1234564565464");
				console.log(this.token);
			},
			itemClick:function(ev){
				console.log(ev);
			},
			navSwiper() {
				uni.navigateTo({
					url:'/pages/swiper/swiper'
				})
			},
		}
	}
</script>

<style>
	.content {
		text-align: center;
		overflow-x: hidden;
		word-break: break-word;
	}

	.logo {
		height: 200upx;
		width: 200upx;
		margin-top: 200upx;
	}

	.title {
		font-size: 36upx;
		color: #8f8f94;
	}
	.pwd-wrap{
		margin-bottom: 60upx;
	}
</style>
